/**
 * 
 */
package jobads;

import jobadvertisement.JobAdvertisementDTO;
import jobadvertisement.JobAdvertisementDAO;
import jobads.CreateJobAdsScreen;
/**
 * @author thomas_dao
 *
 */
public class JobAdsController {

    private JobAdvertisementDAO dao;
    
    public JobAdsController() {
        dao = new JobAdvertisementDAO();
    }
    
    public void createNewJobScreen() {
        new CreateJobAdsScreen().setVisible(true);
    }
    
    public void createNewJobAds(JobAdvertisementDTO newJobAds) {
        dao.readDTOs();
        dao.addDTO(newJobAds);
        dao.writeDTOs();
    }

    public void displayEditAds() {
        dao.readDTOs();
        EditAds editScreen = new EditAds(dao.getDTOHashTable());
        editScreen.setVisible(true);
    }

    public void editJobAds(JobAdvertisementDTO selectedJobAds) {
        dao.removeDTO(selectedJobAds.getId());
        dao.addDTO(selectedJobAds);
        dao.writeDTOs();
    }
    public void displayDeleteAds() {
        //JobAdvertisementDAO dao = new JobAdvertisementDAO();
        dao.readDTOs();
        DeleteJobAds deleteScreen = new DeleteJobAds(dao.getDTOHashTable());
        deleteScreen.setVisible(true);
    }

}
